<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>修改密码</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="${base}/css/bootstrap.min.css" rel="stylesheet">
    <link href="${base}/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="${base}/css/style.min.css" rel="stylesheet">
    <link href="${base}/css/animate.css" rel="stylesheet">
</head>

<body>


<div class="container-fluid">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">

                    <form target="_top" method="post" action="${base}/editPwd" class="site-form" onsubmit="return check()">
                        <div class="form-group">
                            <label for="old-password">旧密码</label>
                            <input type="password" class="form-control" name="oldpwd" id="old-password"
                                   placeholder="输入账号的原登录密码">
                        </div>
                        <div class="form-group">
                            <label for="new-password">新密码</label>
                            <input type="password" class="form-control" name="password" id="new-password"
                                   placeholder="输入新的密码">
                        </div>
                        <div class="form-group">
                            <label for="confirm-password">确认新密码</label>
                            <input type="password" class="form-control" name="confirmpwd" id="confirm-password"
                                   placeholder="请输入正确的密码">
                        </div>
                        <button type="submit" class="btn btn-primary">修改密码</button>
                    </form>

                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" src="${base}/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${base}/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${base}/js/main.min.js"></script>
<!--消息提示-->
<script src="${base}/js/bootstrap-notify.min.js"></script>
<script src="${base}/js/lightyear.js"></script>
<script src="${base}/js/main.min.js"></script>
<script>
    function check() {
        var oldPw=document.getElementById("old-password").val;
        var newPw=document.getElementById("new-password").val;
        var confirmPw=document.getElementById("confirm-password").val;
        if (!oldPw.eq(${admin.password})) return false;
        if (!newPw.eq(confirmPw)) return false;
        return true;
    }

</script>
<script>
    if (${!empty error}) {
        lightyear.loading('show');
        // 假设ajax提交操作
        setTimeout(function () {
            lightyear.loading('hide');
            lightyear.notify('${error}', 'danger', 0);
        }, 0)
    }
</script>
</body>
</html>